home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
016a
/
4dgfc4.zip
/
GFC.BTM
next >
Wrap
Text File
|
1991-12-14
|
3KB
|
105 lines
rem GFC - Group File Compare (4th release)
rem by C. Scott Davis
rem Serious Cybernetics
rem Phoenix StarFighter BBS
rem (404) 869-3410 [Fido 1:3616/20]
unset tlp >& nul
unset tdp >& nul
iff "%1" EQ "" then
echo Usage : GFC filespec [listfile] [/d]
quit
endiff
echo ``
echo Checking for duplicate files in %_cwds%%1
iff "%2" NE "" then
iff "%@upper[%2]" EQ "/D" then
set tdp=%2
else
set tlp=%@upper[%2]
endiff
endiff
iff "%3" NE "" then
iff "%@upper[%3]" EQ "/D" then
set tdp=%3
else
set tlp=%@upper[%3]
endiff
endiff
iff "%tlp" NE "" then
echo File list will be written to %tlp
endiff
iff "%tdp" NE "" then
echo Duplicate files will be deleted
endiff
pushd %temp >& nul
set ttmp=%_cwds >& nul
popd >& nul
dir %1 /a-d-h-s /os /f > %ttmp%tdir >&> nul
set tdc=0
set tcz=%@lines[%ttmp%tdir] >& nul
set tc1=0
echo ``
:loop1
set tc2=%@eval[%tc1+1]
set tf1=%@upper[%@line[%ttmp%tdir,%tc1]]
:loop2
set tf2=%@upper[%@line[%ttmp%tdir,%tc2]]
iff exist %tf1 .AND. "%tf1" NE "**EOF**" .AND. exist %tf2 .AND. "%tf2" NE "**EOF**" then
echos Comparing %@name[%tf1].%@ext[%tf1] and %@name[%tf2].%@ext[%tf2] ...
iff %@filesize[%tf1] EQ %@filesize[%tf2] then
fc /b %tf1 %tf2 > %ttmp%tlog >&> nul
unset tkb >& nul
iff "%@line[%ttmp%tlog,1]" EQ "FC: no differences encountered" then
iff "%tlp" NE "" then
echos %@name[%tf1].%@ext[%tf1] and %@name[%tf2].%@ext[%tf2] are the same >> %tlp >&> nul
iff "%tdp" EQ "/D" then
echo ` (deleted)` >> %tlp >&> nul
else
echo `` >> %tlp >&> nul
endiff
endiff
echos ` *** SAME ***`
iff "%tdp" EQ "/D" then
del %tf2 >& nul
echos ` (deleted)`
endiff
set tdc=%@eval[%tdc+1]
endiff
else
set tc2=%@eval[%tcz]
endiff
echo ``
unset tkb >& nul
inkey /w0 %%tkb >& nul
iff "%tkb" EQ "e" then
echo *** CANCEL ***
goto end
endiff
endiff
set tc2=%@eval[%tc2+1] >& nul
if %tc2 LE %tcz goto loop2
set tc1=%@eval[%tc1+1] >& nul
if %tc1 LE %tcz goto loop1
:end
echo ``
echos %tdc duplicate file(s) found
iff "%tdp" EQ "/D" then
echo ` and deleted`
else
echo ``
endiff
if "%tlp" NE "" echo File list written to %tlp
del %ttmp%tlog >& nul
del %tmp%tdir >& nul
unset tkb >& nul
unset tf1 >& nul
unset tf2 >& nul
unset tc2 >& nul
unset tc1 >& nul
unset tcz >& nul
unset tdc >& nul
unset ttmp >& nul
unset tdp >& nul
unset tlp >& nul